<%@page language="java" import="com.scalar.chiptrack.finance.purchaseorder.PurchaseOrderSetup" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>

<%@ page import="com.scalar.chiptrack.utils.ConfigManager"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html:html>
<HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>

<%String chipTracContext = "/" + ConfigManager.getChipTracContext();%>

<chiptrack:checkLogon sourcePage="/jsp/finance/purchase_order_setup.jsp"/>

<META http-equiv='Content-Type' content='text/html; charset=windows-1252'>
<LINK href='<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css' type='text/css' rel='stylesheet'>
<SCRIPT language='JavaScript'>
function submit()
{
	var pa = document.getElementById("errors");
	pa.innerHTML = '';

	if( checkForNumber( document.purchaseOrderSetupForm.poNextNumber.value ) == false || document.purchaseOrderSetupForm.poNextNumber.value == '' )
	{
		pa.innerHTML = '<li>' + 'Purchase Orders Next Number should end with a Numeric value';
	}
	else if( checkForNumber( document.purchaseOrderSetupForm.receiptNextNumber.value ) == false || document.purchaseOrderSetupForm.receiptNextNumber.value == '' )
	{
		pa.innerHTML = '<li>' + 'Receipts Next Number should end with a Numeric value';
	}
    /*
	else if( checkForNumber( document.purchaseOrderSetupForm.invioceNextNumber.value ) == false || document.purchaseOrderSetupForm.invioceNextNumber.value == '' )
	{
		pa.innerHTML = '<li>' + 'Invoices Next Number should end with a Numeric value';
	}
    */
	else
	{
		document.purchaseOrderSetupForm.submit();
	}

    //
}
function cancel()
{
    document.purchaseOrderSetupForm.reset();
}

function checkForNumber( number )
{
	if( number.length > 0 )
	{
		var numlen = number.length;
		var endingChar = number.charAt( numlen - 1 );
		if( ( endingChar < '0' ) || ( endingChar > '9' ) )
		{
			return false;
		}
	}
}

</SCRIPT>

</SCRIPT>
</HEAD>
<BODY bgColor='#ffffff' leftMargin='0' topMargin='0' marginheight='0' marginwidth='0'>
<!-- Top Header Start-->

<%@include file="/jsp/includes/header.jsp"  %>

<!-- Top Header End-->
<p>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TBODY>
  <TR>
	<TD width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>

<!-- Side Navigation start -->

<%@include file="/jsp/finance/purchase_order_menu.jsp" %>

    </TD>
<!-- end of the side navigations -->

    <TD bgcolor="#ffffff">
        <IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8>
    </TD>
    <TD bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2>
    </TD>
    <TD valign="top" width="100%">

<!-- SiteMap Tag --><%--
<chiptrack:sitemap styleClass="NArialS"/>--%>

<chiptrack:permission functionality='<%=Functionality.PURCHASE_ORDER_SETUP%>'
    action='<%=User.USER_ACTION_MODIFY%>' styleClass="NArialL" >
</chiptrack:permission>

        <IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
        <BR>
<!-- from here your body starts -->
			<P>
			<TABLE BORDER="0" WIDTH="100%">
				<TR>
					<TD WIDTH="100%" CLASS="NArialW">
						<P ALIGN="CENTER">Purchase Order Setup
					</TD>
				</TR>
				<TR>
					<TD WIDTH="100%">&nbsp;</TD>
				</TR>
                <TR>
                    <TD><chiptrack:info styleClass="NArialL" /></TD>
                </TR>
                <TR>
                    <TD><chiptrack:errors styleClass="NArialL" /></TD>
                </TR>
                <TR>
                    <TD><chiptrack:moreErrorInfo styleClass="NArialL" /></TD>
                </TR>
                <TR>
					<TD colspan='5' align="left" class='NArialL'><FONT id="errors" styleClass="NArialL" color='FF0000'></FONT>
					</TD>
				</TR>
				<TR>
					<TD WIDTH="100%">
            <html:form name="purchaseOrderSetupForm" action="/purchaseOrderSetup.do?action=save" method="post" type="com.scalar.chiptrack.finance.purchaseorder.forms.PurchaseOrderSetupForm">
        <TABLE BORDER="0" WIDTH="100%" CLASS="NArialL">
		    <TR>
			    <TD WIDTH="100%">

                    <TABLE BORDER="0" WIDTH="100%" CLASS="NArialL">
					    <TR>
						    <TD WIDTH="100%">
							    <TABLE BORDER="0" WIDTH="100%" CLASS="NArialL">
						        <TR>
						            <TD WIDTH="20%">&nbsp;</TD>
							        <TD WIDTH="17%">&nbsp;</TD>
							        <TD WIDTH="1%">&nbsp;</TD>
							        <TD WIDTH="5%" BGCOLOR="#990000"><FONT COLOR="white">Code</FONT></TD>
							        <TD WIDTH="1%">&nbsp;</TD>
							        <TD WIDTH="16%" BGCOLOR="#990000" ALIGN="CENTER"><FONT COLOR="white">Next Number</FONT></TD>
							        <TD WIDTH="1%">&nbsp;</TD>
							        <TD WIDTH="24%">&nbsp;</TD>
							        <TD WIDTH="15%">&nbsp;</TD>
						        </TR>
						    <TR>
						        <TD WIDTH="20%">&nbsp;</TD>
							    <TD WIDTH="17%">Purchase Orders :</TD>
							    <TD WIDTH="1%">&nbsp;</TD>
							    <TD WIDTH="5%">
                                    <html:text name ="purchaseOrderSetupForm" property="poCode" size="4" styleClass="txfield" maxlength="3"/>
                                </TD>
                                <TD WIDTH="1%" >&nbsp;</TD>
							    <TD WIDTH="16%">
                                    <html:text name ="purchaseOrderSetupForm" property="poNextNumber" size="21" styleClass="txfield" maxlength="17"/>
                                </TD>
							    <TD WIDTH="1%">&nbsp;</TD>
							    <TD WIDTH="24%">&nbsp;</TD>
							    <TD WIDTH="15%">&nbsp;</TD>
						    </TR>
						    <TR>
						        <TD WIDTH="20%">&nbsp;</TD>
							    <TD WIDTH="17%">Receipts :</TD>
							    <TD WIDTH="1%">&nbsp;</TD>
							    <TD WIDTH="5%">
                                    <html:text name ="purchaseOrderSetupForm" property="receiptCode" size="4" styleClass="txfield" maxlength="3"/>
                                </TD>
							    <TD WIDTH="1%">&nbsp;</TD>
							    <TD WIDTH="16%">
                                    <html:text name ="purchaseOrderSetupForm" property="receiptNextNumber" size="21" styleClass="txfield" maxlength="17"/>
                                </TD>
							    <TD WIDTH="1%">&nbsp;</TD>
							    <TD WIDTH="24%">&nbsp;</TD>
							    <TD WIDTH="15%">&nbsp;</TD>
						    </TR>
						    <TR>
						        <TD WIDTH="20%">&nbsp;</TD>
							    <!--TD WIDTH="17%">Invoices :</TD-->
							    <TD WIDTH="17%">&nbsp;</TD>
							    <TD WIDTH="1%">&nbsp;</TD>
							    <TD WIDTH="5%">&nbsp;
                                    <%/*html:text name ="purchaseOrderSetupForm" property="invoiceCode" size="4" styleClass="txfield" maxlength="3"*/%>
                                </TD>
							    <TD WIDTH="1%">&nbsp;</TD>
							    <TD WIDTH="16%">&nbsp;
                                    <%/*html:text name ="purchaseOrderSetupForm" property="invioceNextNumber" size="21" styleClass="txfield" maxlength="17"*/%>
                                </TD>
							    <TD WIDTH="1%">&nbsp;</TD>
							    <TD WIDTH="24%">&nbsp;</TD>
							    <TD WIDTH="15%">&nbsp;</TD>
						    </TR>
						    <!--TR>
						        <TD WIDTH="100%" colspan="9">&nbsp;</TD>
						    </TR-->
    			  </TABLE>
        <TABLE BORDER="0" WIDTH="100%" CLASS="NArialL">
		    <TR>
		        <TD WIDTH="19%">&nbsp;</TD>
			    <TD WIDTH="16%">PO Line Site Name:</TD>
                <TD WIDTH="1%">&nbsp;</TD>
			    <TD WIDTH="32%" align="left">
			        <html:select name="purchaseOrderSetupForm" property="poLineSiteId" styleClass="txfield" >
                            <html:options collection = "poLineSiteIdList" property="value" labelProperty="label"/>
                    </html:select>
				</TD>
                <TD WIDTH="32%">&nbsp;</TD>
			</TR>
		</TABLE>
<BR>
	</TD>
</TR>
<TR>
    <TD WIDTH="100%">&nbsp;</TD>
</TR>
</TABLE>
<BR>
    </TD>
</TR>
</TABLE>
<html:hidden name ="purchaseOrderSetupForm" property="index1" />
       </html:form>
    </TD>
</TR>
<TR>
    <TD WIDTH="100%">
        <TABLE BORDER="0" WIDTH="100%">
<TR>
    <TD WIDTH="50%"><P ALIGN="RIGHT">
       <chiptrack:restrictedLink functionality="<%=Functionality.PURCHASE_ORDER_SETUP%>"
       action="<%=User.USER_ACTION_MODIFY%>" href="javascript:submit()" onmouseover="window.status='Click here to save Purchase Order Setup values';return true" onmouseout="window.status='';return true">
	   <IMG SRC="<%=chipTracContext%>/jsp/includes/images/save.gif" ALIGN="BOTTOM" BORDER="0">
       </chiptrack:restrictedLink>
    </TD>
	<TD WIDTH="50%"><a href="<%=chipTracContext%>/jsp/finance/finance_po.jsp" onmouseover="window.status='Click here to go back Purchase Orders Menu';return true" onmouseout="window.status='';return true"><IMG SRC="<%=chipTracContext%>/jsp/includes/images/cancel.gif" ALIGN="BOTTOM" BORDER="0"></a></TD>
</TR>
</TABLE>
    </TD>
</TR>
</TABLE>
<!-- Your Work area ends here -->
    </TD>
		<TD BGCOLOR="white"><IMG SRC="images/spacer.gif" WIDTH="1" HEIGHT="1" ALIGN="BOTTOM" BORDER="0"></TD>
</TR>
</TBODY></TABLE>

<!-- Footer starts here -->

<%@include file="/jsp/includes/footer.jsp" %>

<!-- footer end here -->
</BODY>
</html:html>